﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuManager.ascx.cs" Inherits="Member_Control_MenuManager" %>
<h2>
    Hệ thống menu</h2>
<div style="margin-bottom: 15px">
    Nhóm menu
    <asp:DropDownList ID="ddlMenu" runat="server" AppendDataBoundItems="true" Width="250px">
        <asp:ListItem Value="">------------------ Chọn Menu -----------------</asp:ListItem>
    </asp:DropDownList>
    <span class="button fix">
        <asp:Button ID="btnUpdate" runat="server" Text="Cập nhật" 
        onclick="btnUpdate_Click"/>
        <span></span></span>
</div>
<table class="grid" id="table-dnd">
    <thead>
        <tr>
            <th width="35">
            </th>
            <th width="200">
                Tên menu
            </th>
            <th >
                Url
            </th>
            <th width="180">
                Menu cha
            </th>
            <th width="40">
                <input type="checkbox" />
            </th>
        </tr>
    </thead>
    <tbody>
    <asp:Repeater ID="rep" runat="server" onitemdatabound="rep_ItemDataBound">
        <ItemTemplate>
            <tr>
                <td class="drag-handle" align="right">
                    <asp:HiddenField ID="hidDispOrder" runat="server" Value='<%# Eval("OrderIndex")%>' />
                    <asp:Label ID="lblDisp" CssClass="lblDisp" runat="server" Text='<%# Eval("OrderIndex")%>'>
                    </asp:Label>
                    <asp:HiddenField ID="hidId" runat="server" Value='<%# Eval("Id") %>' />
                </td>
                <td>
                    <asp:TextBox ID="txtMenuName" runat="server" Text='<%# Eval("MenuName") %>' Width="99%"></asp:TextBox>
                </td>
                <td>
                    <asp:TextBox ID="txtUrl" runat="server" Text='<%# Eval("Url") %>' Width="99%"></asp:TextBox>
                </td>
                <td align="center">
                    <asp:DropDownList ID="ddlFuncMenu" runat="server" AppendDataBoundItems="true" Width="170px"
                        DataSource="<%# tblMenu.DefaultView %>" DataTextField="MenuName" DataValueField="Id">
                    </asp:DropDownList>
                </td>
                <td align="center">
                    <asp:CheckBox ID="chkEnable" runat="server" Checked='<%# Eval("IsEnable") %>' />
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
    </tbody>
</table>
<script type="text/javascript">
    $(document).ready(function(){
        $("select[id*='ddlMenu']").change(function(){
            var role = $.url.param('r');
            window.location = "/Member/Menu.aspx?m=" + $(this).val();
        });
        
        grid_checkbox(".grid input[type='checkbox']")
    });
</script>